package userlogic

import (
	"context"
	"gitee.com/liuxuezhan/ar-platform/assets-rpc/internal/service"
	"gitee.com/liuxuezhan/ar-platform/assets-rpc/pkg/xerrors"

	"gitee.com/liuxuezhan/ar-platform/assets-rpc/internal/svc"
	"gitee.com/liuxuezhan/ar-platform/assets-rpc/rpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type UserWalletLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewUserWalletLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserWalletLogic {
	return &UserWalletLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 获取钱包列表
func (l *UserWalletLogic) UserWallet(in *rpc.UserWalletRequest) (*rpc.UserWalletResponse, error) {
	if len(in.UserIds) < 0 {
		return nil, xerrors.ErrInvalidParameterUserIds
	}
	ret, err := service.UserWallet(l.ctx, l.svcCtx, in)
	if err != nil {
		return nil, err
	}
	return ret, nil
}
